@inherits AssignmentBase<SelectedItem>

@if (EnableSearch)
{
    <div class="mb-2">
        <BootstrapInput @bind-Value="SearchKeyword" Placeholder="搜索..." />
    </div>
}

@if (ShowSelectAll)
{
    <div class="mb-2">
        <button class="btn btn-sm btn-primary me-2" @onclick="SelectAll">全选</button>
        <button class="btn btn-sm btn-secondary" @onclick="DeselectAll">取消全选</button>
    </div>
}

@if (GroupBy != null)
{
    @foreach (var group in FilteredItems.GroupBy(GroupBy))
    {
        <div class="mb-2">
            <h6>@group.Key</h6>
            <CheckboxList Items="group.ToList()" @bind-Value="InternalValue" IsVertical="true" ShowBorder="false" ShowLabel="false" />
        </div>
    }
}
else
{
    <CheckboxList Items="FilteredItems" @bind-Value="InternalValue" IsVertical="true" ShowBorder="false" ShowLabel="false" />
}